import { registerAppMenu } from '@/app'
import { setInteraction } from '@/map-interaction'
import { registerAuxGraphicType } from '../core'
import { toFeature, toLineString, type AuxLine } from './core'
import { DrawAuxLine } from './draw-aux-line'
import AuxLineInfoVue from './AuxLineInfo.vue'

export function setupAuxLine() {
  registerAuxGraphicType<AuxLine>({
    type: 'Line',
    typeName: '测量线',
    geometry: (e) => [toLineString(e)],
    feature: toFeature,
    component: AuxLineInfoVue
  })
  registerAppMenu({
    path: '工具/地图Aux:绘制测量线',
    onClick() {
      setInteraction(new DrawAuxLine())
    }
  })
}
